﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;


namespace FoodStage
{
    public class MobileController : ApiController
    {
        DatacontextDataContext _db = new DatacontextDataContext();
        // GET api/<controller>
        public IEnumerable<Categories> Get()
        {
            try
            {
                int dem = 0;
                var p = (from i in _db.Categories
                         select new Categories
                         {
                             ID = i.CategoryID,
                             Noidung = i.CategoryName,
                             Mota = i.Description,
                            
                         }).ToList();
                return p;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        // GET api/<controller>/5
        public string Get(int id)
        {
            return "value";
        }

        // POST api/<controller>
        public void Post([FromBody]string value)
        {
        }

        // PUT api/<controller>/5
        public void Put(int id, [FromBody]string value)
        {
        }

        // DELETE api/<controller>/5
        public void Delete(int id)
        {
        }
        
    }
    public class Categories
    {
        public int ID { get; set; }
        public string Noidung { get; set; }
        public string Mota { get; set; }
        
    }
}